const formatCount = (count) => {
  count = parseInt(count);
  if (count >= 100000000) {
    return (count / 100000000).toFixed(1) + '亿';
  } else if (count >= 10000) {
    return (count / 10000).toFixed(1) + '万';
  } else {
    return count;
  }
};

// 2 -> 02
// 24 -> 24
const padLeft = (time) => {
  time = time + '';
  return ('00' + time).slice(time.length);
};

// 对time进行格式化
// 100 -> 01:40
const formatTime = (time) => {
  // 0.将毫秒转成秒
  time = time / 1000;

  // 1.获取时间
  const minute = Math.floor(time / 60);
  const second = Math.floor(time) % 60;

  // 2.拼接字符串
  return padLeft(minute) + ':' + padLeft(second);
};

export { formatCount, formatTime };
